Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 1x 1x 1x 1x 1x 1x | import { NextResponse, type NextRequest } from "next/server";
import { serveItemPhotoFile } from "@/server/api/item-photo-file";
// sharp (used by servePhotoFile) is a native addon — pin the Node runtime.
export const runtime = "nodejs";
export async function GET(
request: NextRequest,
{ params }: { params: Promise<{ photoId: string }> },
) {
const { photoId } = await params;
const collectionId = request.nextUrl.searchParams.get("collectionId");
const itemId = request.nextUrl.searchParams.get("itemId");
Iif (!collectionId || !itemId) {
return NextResponse.json({ error: "Missing photo scope" }, { status: 400 });
}
return serveItemPhotoFile(
request,
Promise.resolve({ id: collectionId, itemId, photoId }),
);
}
|